package com.frxuexi.mdm2202.ui

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.frxuexi.apps.AppsPage
import com.frxuexi.department.DepartmentPage
import com.frxuexi.department.LocalDocPage
import com.frxuexi.lib_base.NavPath
import com.frxuexi.mine.ui.LoginPage
import com.frxuexi.mine.ui.MinePage
import com.frxuexi.mine.ui.RegisterPage
import com.frxuexi.report.CommitReportPage
import com.frxuexi.report.ReportPage
import com.frxuexi.sign.SignCommitPage
import com.frxuexi.sign.SignPage

@Composable
fun MyNavHost(navController: NavHostController, values: PaddingValues) {
    NavHost(
        navController = navController,
        startDestination = NavPath.HOME,
        modifier = Modifier.padding(values)
    ) {
        //登录页
        composable(NavPath.LOGIN) { LoginPage(navHostController = navController) }
        //主页面
        /*composable(NavPath.MAIN){
            MainPage(navController =navController )
        }*/
        composable(NavPath.MESSAGES) {
            MessagePage()
        }
        composable(NavPath.HOME) {
            HomePage(navController)
        }
        composable(NavPath.MINE) {
            MinePage(navHostController = navController)
        }
        composable(NavPath.APPS) { AppsPage(navHostController = navController) }
        composable(NavPath.DEPARTMENT) { DepartmentPage(navHostController = navController) }
        composable(NavPath.LOCALDOC) { LocalDocPage(navHostController = navController) }
        composable(NavPath.REPORT) { ReportPage(navHostController = navController) }
        composable(NavPath.COMMIT_REPORT + "/{report}") {
            val json = it.arguments?.getString("report", "")
            if (json != null) {
                CommitReportPage(navHostController = navController, json)
            }
        }
        composable(NavPath.SIGN) { SignPage(navHostController = navController) }
        composable(NavPath.SIGN_COMMIT) { SignCommitPage(navHostController = navController) }
        composable(NavPath.REGISTER) { RegisterPage(navHostController = navController) }
    }
}